home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_075 / dum2 / src / view.mod < prev    next >
Text File  |  1992-05-06  |  1KB  |  50 lines

  1. MODULE View;
  2.  
  3. (* This is a wuickie to allow you to use DuTypefile for viewing
  4.    and printing (both in ascii and hexdump) of files
  5.    see below for usage format.  It is only about 6k when compiled
  6.    and I needed a hexdump print function.
  7. *)
  8.  
  9. (*$S-*)(*$T-*)(*$A+*)
  10. FROM DuTypefile         IMPORT  DisplayASCII,DisplayHex;
  11. FROM CommandLine        IMPORT  GetCL,MaxCLength,CLStrings;
  12. FROM Terminal           IMPORT  WriteString,WriteLn;
  13.  
  14. VAR
  15.   i,
  16.   args  : CARDINAL;
  17.   argv  : ARRAY[0..2] OF CLStrings;
  18.   s,p   : CHAR;
  19.   Scrn,
  20.   Hex   : BOOLEAN;
  21. (* quickie to test the display formats *)
  22.  
  23. (*  view filename [h][p]   or view filename [p][h]  *)
  24.  
  25. BEGIN
  26.   IF GetCL(args,argv) THEN END;
  27.   IF args > 0 THEN
  28.     IF args = 1 THEN
  29.       s := 0C;
  30.       p := 0C;
  31.     ELSIF args > 1 THEN
  32.        s := CAP(argv[1][0])
  33.     END;
  34.     IF args > 2 THEN
  35.       p := CAP(argv[2][0])
  36.     END;
  37.     Scrn := NOT((p = "P") OR (s = "P"));
  38.     Hex  := (p = "H") OR (s = "H");
  39.     i := 0;
  40.     IF Hex THEN
  41.       DisplayHex(argv[0],Scrn)
  42.     ELSE
  43.       DisplayASCII(argv[0],Scrn)
  44.     END
  45.   ELSE
  46.     WriteLn;WriteString("USAGE: view filename [h][p]");WriteLn;
  47.     WriteString("       where h= hex  p= prt:");WriteLn;
  48.   END
  49. END View.
  50.